package com.app.mall.service;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.app.mall.bean.Result;
import com.app.mall.dto.GetGoodsParam;
import com.app.mall.enums.ResultStatus;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Description:兜底方法
 * @Author: zengtaiyang
 * @Date: 2021/4/14 10:54
 * @Version: 1.0
 */
public class FallBackService {

    //fallback
    public static Result handlerFallback(@RequestBody GetGoodsParam param, Throwable throwable) {
        return new Result(ResultStatus.NUMBER_OF_VISITORS_IS_TO_MUCH.getCode(), ResultStatus.NUMBER_OF_VISITORS_IS_TO_MUCH.getMessage(), null);
    }

    //blockHandler
    public static Result blockHandler(@RequestBody GetGoodsParam param, BlockException blockException) {
        return new Result(ResultStatus.SYSTEM_EXCEPTION.getCode(), ResultStatus.SYSTEM_EXCEPTION.getMessage(), null);
    }

}
